load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library")
load("@fbcode_macros//build_defs:cpp_unittest.bzl", "cpp_unittest")
load("@fbcode_macros//build_defs/lib:re_test_utils.bzl", "re_test_utils")

oncall("fbcode_entropy_wardens_folly")

cpp_unittest(
    name = "AsyncSocketHandlerTest",
    srcs = ["AsyncSocketHandlerTest.cpp"],
    remote_execution = re_test_utils.remote_execution_linux_default(),
    deps = [
        ":mocks",
        "//folly/portability:gtest",
        "//wangle/channel:async_socket_handler",
        "//wangle/channel:pipeline",
    ],
)

cpp_unittest(
    name = "FileRegionTest",
    srcs = ["FileRegionTest.cpp"],
    remote_execution = re_test_utils.remote_execution_linux_default(),
    deps = [
        "//folly/io/async/test:async_socket_test_lib",
        "//folly/portability:gtest",
        "//wangle/channel:file_region",
    ],
)

cpp_library(
    name = "mocks",
    headers = [
        "MockHandler.h",
        "MockPipeline.h",
    ],
    exported_deps = [
        "//folly:move_wrapper",
        "//folly/portability:gmock",
        "//wangle/channel:handler",
        "//wangle/channel:pipeline",
    ],
)

cpp_unittest(
    name = "OutputBufferingHandlerTest",
    srcs = ["OutputBufferingHandlerTest.cpp"],
    remote_execution = re_test_utils.remote_execution_linux_default(),
    deps = [
        ":mocks",
        "//folly/io/async:async_socket",
        "//folly/portability:gmock",
        "//folly/portability:gtest",
        "//wangle/channel:output_buffering_handler",
        "//wangle/channel:static_pipeline",
    ],
)

cpp_unittest(
    name = "PipelineTest",
    srcs = ["PipelineTest.cpp"],
    remote_execution = re_test_utils.remote_execution_linux_default(),
    deps = [
        ":mocks",
        "//folly/portability:gmock",
        "//folly/portability:gtest",
        "//wangle/channel:async_socket_handler",
        "//wangle/channel:handler",
        "//wangle/channel:output_buffering_handler",
        "//wangle/channel:pipeline",
        "//wangle/channel:static_pipeline",
    ],
    external_deps = [
        ("boost", None, "boost_thread"),
    ],
)
